package com.eastfair.common.controller;
import com.eastfair.common.dto.*;
import com.eastfair.common.req.JYReq;
import com.eastfair.common.res.JYFinanceRes;
import com.eastfair.common.service.FinanceService;
import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * <p>
 * 同步财务
 * 
 * </p>
 *
 * @author clm
 * @date 2022-12-22
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/finance")
@Api(value = "FinanceController", tags = "")
public class FinanceController {

    @Resource
    private FinanceService financeService;

    /**
     * @Author fwl
     * @Description //同步记录到荆艺
     * @Date 9:54 2023/3/21
     * @Param [req]
     **/
    @PostMapping("/sync")
    public R<List<JYMainnoResultDTO>> syncOrder(@RequestBody JYReq  req) {
        try {
            List<JYMainnoResultDTO> res = financeService.sync(req);
            return R.success(res);
        } catch(BizException biz) {
            return R.fail(biz);
        }
    }


}

